<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            height: 300px;
            background-color: orange;
            margin-bottom: 20px;
        }
        div:target {
            background: green;
        }
    </style>
</head>
<body>
    <a href="#tag1">tag1</a>
    <a href="#tag2">tag2</a>
    <a href="#tag3">tag3</a>
    <a href="#tag4">tag4</a>
    <a href="#tag5">tag5</a>
    <a href="#tag6">tag6</a>
    <a href="#tag7">tag7</a>
    <a href="#tag8">tag8</a>
    <h1>目标伪类</h1>
    <div id="tag1">第1个div</div>
    <div id="tag2">第2个div</div>
    <div id="tag3">第3个div</div>
    <div id="tag4">第4个div</div>
    <div id="tag5">第5个div</div>
    <div id="tag6">第6个div</div>
    <div id="tag7">第7个div</div>
    <div id="tag8">第8个div</div>
</body>
</html>